<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
    <meta charset="UTF-8">
    <title>实验室管理</title>
    <style>
        /* 全局样式 */
        body {
            font-family: 'PingFang SC', 'Microsoft YaHei', Arial, sans-serif;
            background-color: #f5f7fa;
            margin: 0;
            padding: 0;
            color: #333;
            line-height: 1.6;
        }

        /* 导航栏样式 */
        .navbar {
            background-color: #ffffff;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            padding: 12px 0;
            position: sticky;
            top: 0;
            z-index: 100;
        }

        .navbar-container {
            display: flex;
            justify-content: space-between;
            align-items: center;
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 20px;
        }

        .navbar-brand {
            font-size: 18px;
            font-weight: 600;
            color: #2c3e50;
            text-decoration: none;
            display: flex;
            align-items: center;
        }

        .navbar-brand i {
            margin-right: 8px;
            color: #2980b9;
        }

        .navbar-nav {
            display: flex;
            align-items: center;
        }

        .nav-link {
            color: #555;
            font-size: 14px;
            text-decoration: none;
            font-weight: 500;
            margin-left: 15px;
            transition: color 0.3s ease;
            padding: 5px 10px;
            border-radius: 4px;
        }

        .nav-link:hover {
            color: #2980b9;
            background-color: #f0f8ff;
        }

        .btn-group {
            display: flex;
            align-items: center;
            margin-left: 15px;
        }

        .btn-group .btn {
            margin-left: 8px;
            padding: 6px 12px;
            border-radius: 4px;
            font-size: 13px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s ease;
            white-space: nowrap;
        }

        .btn-primary {
            background-color: #3498db;
            color: white;
            border: none;
        }

        .btn-primary:hover {
            background-color: #2980b9;
        }

        .btn-outline-primary {
            background-color: transparent;
            color: #3498db;
            border: 1px solid #3498db;
        }

        .btn-outline-primary:hover {
            background-color: #3498db;
            color: white;
        }

        .btn-success {
            background-color: #2ecc71;
            color: white;
            border: none;
        }

        .btn-success:hover {
            background-color: #27ae60;
        }

        .btn-warning {
            background-color: #f39c12;
            color: white;
            border: none;
        }

        .btn-warning:hover {
            background-color: #d35400;
        }

        .btn-info {
            background-color: #3498db;
            color: white;
            border: none;
        }

        .btn-info:hover {
            background-color: #2980b9;
        }

        .btn-danger {
            background-color: #e74c3c;
            color: white;
            border: none;
        }

        .btn-danger:hover {
            background-color: #c0392b;
        }

        .welcome-text {
            margin-left: 15px;
            font-size: 14px;
            color: #555;
        }

        /* 主容器样式 */
        .container {
            max-width: 1200px;
            margin: 30px auto;
            padding: 0 20px;
        }

        .flex {
            display: flex;
            gap: 20px;
            margin-top: 20px;
        }

        .mt-6 {
            margin-top: 20px;
        }



        .space-y-2 {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .sidebar-item {
            display: block;
            padding: 10px 15px;
            border-radius: 5px;
            text-decoration: none;
            color: #555;
            font-weight: 500;
            transition: all 0.3s ease;
        }

        .sidebar-item:hover {
            background-color: #e8f5e9;
            color: #3a7d44;
        }



        h2 {
            color: #2c3e50;
            margin-bottom: 15px;
            font-size: 24px;
        }

        .text-2xl {
            font-size: 24px;
        }

        .font-bold {
            font-weight: 600;
        }

        .text-gray-800 {
            color: #2c3e50;
        }

        .mb-4 {
            margin-bottom: 15px;
        }

        .text-sm {
            font-size: 14px;
        }

        .text-gray-500 {
            color: #7f8c8d;
        }

        .mb-6 {
            margin-bottom: 20px;
        }

        /* 实验室列表样式 */
        .grid {
            display: grid;
            grid-template-columns: repeat(1, 1fr);
            gap: 15px;
        }

        @media (min-width: 768px) {
            .grid {
                grid-template-columns: repeat(2, 1fr);
            }
        }

        .lab-card {
            background-color: #f9f9f9;
            border: 1px solid #eaeaea;
            border-radius: 8px;
            padding: 15px;
        }

        .text-lg {
            font-size: 16px;
        }

        .font-semibold {
            font-weight: 600;
        }

        .text-gray-600 {
            color: #555;
        }

        .mt-6 {
            margin-top: 20px;
        }

        .text-center {
            text-align: center;
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            .navbar-container {
                flex-direction: column;
                align-items: flex-start;
            }

            .navbar-nav {
                margin-top: 15px;
                flex-wrap: wrap;
            }

            .btn-group {
                margin-top: 8px;
                margin-left: 0;
            }

            .welcome-text {
                margin: 8px 0;
            }

            .flex {
                flex-direction: column;
            }

            .w-1/4, .w-3/4 {
            width: 100%;
        }
        }
    </style>
</head>
<body>

<!-- 导航栏 -->
<nav class="navbar">
    <div class="navbar-container">
        <a class="navbar-brand" href="#">
            <i class="fas fa-flask"></i>
            实验室辅助管理系统
        </a>
        <div class="navbar-nav">
            <span sec:authorize="isAuthenticated()">
                <div class="btn-group">
                    <a href="/laboratory/Info" class="btn btn-sm btn-outline-success active">实验室管理</a>
                    <a href="/email" class="btn btn-sm btn-outline-info">邮箱</a>
                    <a href="/user/admin" class="btn btn-sm btn-outline-warning">管理员界面</a>
                    <a href="/user/userInfo" class="btn btn-sm btn-outline-primary">个人中心</a>
                    <span class="welcome-text">欢迎, <span sec:authentication="name"></span>!</span>
                    <a href="/user/logout" class="btn btn-sm btn-outline-danger">退出</a>
                </div>
            </span>
        </div>
    </div>
</nav>

<!-- 主容器 -->
<div class="container">
    <div class="flex">

        <!-- 左侧菜单 -->
        <div class="w-1/4" th:if="${!labMap.isEmpty()}">
            <ul class="space-y-2">
                <li><a href="/item/list" class="sidebar-item hover:bg-gray-100 rounded">物品管理</a></li>
                <li><a href="/safety-inspection/list" class="sidebar-item hover:bg-gray-100 rounded">安全检查登记</a></li>
                <li><a href="/safety-inspection/" class="sidebar-item hover:bg-gray-100 rounded">今日安全检查登记</a></li>
            </ul>
        </div>

        <!-- 右侧内容 -->
        <div class="w-3/4">
            <h2 class="text-2xl font-bold text-gray-800 mb-4">欢迎，<span th:text="${user.username}">用户名</span></h2>
            <p class="text-gray-600 mb-6">你管理的实验室如下：</p>

            <!-- 实验室列表 -->
            <div class="grid">
                <div th:each="lab : ${labMap}" class="lab-card">
                    <h3 class="text-lg font-semibold text-gray-800" th:text="${lab.value}">实验室名称</h3>
                    <p class="text-sm text-gray-500" th:text="'ID: ' + ${lab.key}">实验室 ID</p>
                </div>
            </div>

            <!-- 没有实验室时提示 -->
            <div class="mt-6 text-center text-gray-500" th:if="${labMap.isEmpty()}">
                你目前没有管理任何实验室，请联系管理员分配权限或前往管理员界面进行设置。
                如果你是超级管理员，请移步管理员界面
            </div>
        </div>
    </div>
</div>

</body>
</html>